
#pragma once

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <fcntl.h>

#include "H264ParseSPS.h"

#ifdef __cplusplus
extern "C"
{
#endif

union voidint{void*p;int i;};

enum FLVDST{HTTP_FLV=1, STREAM_FLV};

struct flv_t
{
    void *fd;
    enum FLVDST dst;
    uint32_t audio_ts;
    uint32_t video_ts;
    double rate;    // 帧率
    struct metadata_t metadata;
};

void send_audio(struct flv_t *flv, uint8_t *pdata, size_t size);
void send_video(struct flv_t *flv, uint8_t *pdata, size_t size);
void close_flv(struct flv_t *flv);
struct flv_t *open_flv(void *fd, enum FLVDST flvdst, struct metadata_t *, const char *ext_head);
#ifdef __cplusplus
}
#endif
